import { GETPRODUCTLIST, GETSECONDLIST, SEARCH } from './mutations-types'
import { setStore, getStore } from '@/untils/storage'
export default{
  [GETPRODUCTLIST] (state, list) {
    if (list.status === 200 || list.status === 304) {
      state.productList = list.data.data
    }
  },
  [GETSECONDLIST] (state, list) {
    // 请求状态 为200 或者304  表示成功
    if (list.status !== 200 && list.status !== 304) {
      return
    }
    state.secondList = list.data.data
    setStore('secondlist', list.data.data)
  },
  [SEARCH] (state) {
    const serchVal = getStore('search')
    const pageVal = getStore('page')
    state.search = serchVal
    state.page = pageVal
  }
}
